/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.insa.glaizot;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.sql.SQLException;
import javax.swing.JFrame;

/**
 * pour fermer la connection quand on ferme la fenetre
 * 
 */
public class BdDFrame extends JFrame implements WindowListener {

    public BdDFrame() {
        super();
        this.addWindowListener(this);
    }

    public BdDFrame(String titre) {
        super(titre);
        this.addWindowListener(this);
    }



    public void windowOpened(WindowEvent e) {

    }

    public void windowClosing(WindowEvent e) {
        try {
            System.out.println("coucou");
            TestSGBD.defautCon.close();
        } catch (SQLException ex) {
            throw new Error(ex);
        }
    }

    public void windowClosed(WindowEvent e) {

    }

    public void windowIconified(WindowEvent e) {

    }

    public void windowDeiconified(WindowEvent e) {

    }

    public void windowActivated(WindowEvent e) {
    
    }


    public void windowDeactivated(WindowEvent e) {

    }

}
